const AipOcr = require('../util/aip').ocr,
  log = require('../util/log')

var configs = [{
    APP_ID: '10009061',
    API_KEY: 'MYjGprwc2MbxWKNwZhBLUv6w',
    SECRET_KEY: 'I5gchCTXWGD4uURb1rpjVyl2mBY8h2VQ'
  }, {
    APP_ID: '10153451',
    API_KEY: 'GuOMsk4XZVehl5reGgfjnfxC',
    SECRET_KEY: 'VYhcC9FLRzQBCX8o1U3Z3m2N4olFmxa1'
  }],
  index = 0

exports.aipOcr = new AipOcr(configs[0].APP_ID, configs[0].API_KEY, configs[0].SECRET_KEY);
exports.switch = () => {
  index++
  if (index < configs.length) {
    exports.aipOcr = new AipOcr(configs[index].APP_ID, configs[index].API_KEY, configs[index].SECRET_KEY);
  } else {
    log('没有可用的AipOcr')
    exports.aipOcr = null
  }
}
